package dnl.ui.clipboard;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;

import org.apache.commons.io.FileUtils;

/**
 * 
 *
 * @author <a href="mailto:daniel.or@gmail.com">Daniel Or</a>
 *
 */
public class FileContent implements Serializable {

	private String fileName;
	private byte[] bytes;
	
	public FileContent(String fileName, byte[] bytes) {
		this.fileName = fileName;
		this.bytes = bytes;
	}

	public String getFileName() {
		return fileName;
	}

	public byte[] getBytes() {
		return bytes;
	}
	
	public static FileContent fromFile(File f) throws IOException{
		byte[] byteArray = FileUtils.readFileToByteArray(f);
		return new FileContent(f.getName(), byteArray);
	}
}
